home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…ch: Other People's Memory / ADC Developer CD (1993-03) (''Other People's Memory'')_iso / Dev.CD Mar 93.iso / Development Platforms / Apple II / Essentials / Technical.Notes / IIGS / TN.IIGS.091 < prev    next >
Encoding:
Text File  |  1992-07-15  |  11.2 KB  |  239 lines  |  [TEXT/GEOL]

  1. Apple II
  2. Technical Notes
  3. _____________________________________________________________________________
  4.                                                   Developer Technical Support
  5. Apple IIgs
  6. #91: The Wonderful World of Universal Access
  7.  
  8. Revised by: Dave Lyons                                               May 1992
  9. Written by: Don J. Brady, Matt Deatherage, & Ron Lichty        September 1990
  10.  
  11. This Technical Note discusses how your applications can be compatible with
  12. Universal Access software.
  13.  
  14. CHANGES SINCE JULY 1991:  Added caution against reading the keyboard with
  15. interrupts disabled.
  16. _____________________________________________________________________________
  17.  
  18.  
  19. WHAT'S "UNIVERSAL ACCESS?"
  20.  
  21. Universal Access is the name given to software components designed to make
  22. Apple computers (in this case, the Apple IIgs) more accessible to people who
  23. might have difficulty using them.  The Apple IIgs is very dependent on graphic
  24. objects, a keyboard and mouse; not all people can use these things very
  25. easily.
  26.  
  27. There are several components to Apple's Universal Access software:
  28.  
  29.    o   CloseView.  CloseView magnifies the Apple IIgs screen so that it's
  30.        more easily seen by those with visual impairments.  The hardware
  31.        screen contains a magnification from two to twelve times as large as
  32.        the "real" 32K Super Hi-Res graphics screen.
  33.  
  34.    o   Video Keyboard.  Video Keyboard is a New Desk Accessory that emulates
  35.        a keyboard.  A picture of a keyboard appears on the screen; a
  36.        mouse-down event in any "key" makes Video Keyboard post a key-down
  37.        event, so you can use a pointing device as a keyboard.  ADB hardware
  38.        is available to allow people to use head gear or other devices instead
  39.        of mice; Video Keyboard lets these same devices replace the keyboard
  40.        as well.
  41.  
  42.    o   Easy Access.  Easy Access comes in two parts: Sticky Keys and Mouse
  43.        Keys.  Sticky Keys makes the keyboard easier to use for those who have
  44.        trouble pressing more than one key at a time; while Sticky Keys is
  45.        activated, modifier keys may be released and still apply to the next
  46.        keystroke.  Mouse Keys allows the numeric keypad to be used as a mouse
  47.        substitute.  Sticky Keys and Mouse Keys are included in all ROM 03
  48.        Apple IIgs computers.  The software versions allow all Apple IIGS
  49.        computers to provide these functions, and provide additional icon
  50.        feedback (in the upper right menu bar) for Sticky Keys.
  51.  
  52.  
  53. HOW IT WORKS (ACCESS NOTHING AND CHECKS FOR FREE)
  54.  
  55. Universal Access generally works by replacing Apple IIgs toolbox functions.
  56. For example, CloseView patches QuickDraw so you do not draw to the actual
  57. screen, but to another buffer that CloseView can then magnify.  Video Keyboard
  58. patches the Window Manager so that its keyboard window is always frontmost and
  59. fully visible (and accessible).  Easy Access uses the ADB tools and the Event
  60. Manager to alter the way the hardware responds.
  61.  
  62. Since Universal Access changes the way the tools behave, your applications do
  63. not have to work very hard to be accessible to a broad range of physically
  64. challenged people.  Just by following the rules, you have an accessible
  65. application.  There are, however, a few guidelines you should keep in mind
  66. when designing your programs to make them as accessible as they can be.
  67.  
  68.  
  69. UNIVERSAL ACCESS COMPATIBILITY GUIDELINES
  70.  
  71.    o   Don't disable interrupts and then try to read the keyboard.  Easy
  72.        Access on ROM 1 works at the Apple Desktop Bus level--if ADB
  73.        interrupts are not being serviced, no keypresses will show up at
  74.        $C000/$C025.  Even Reset will not work, so the user may have to power
  75.        down to regain control of the machine.
  76.  
  77.    o   Try to avoid using modal dialogs.  Not only do lots of modal dialogs
  78.        make for a cumbersome interface for everyone, they are especially
  79.        annoying to those who have to move the mouse to a lot of OK buttons.
  80.        More importantly, users cannot open NDAs like Video Keyboard while
  81.        modal dialogs are frontmost.
  82.  
  83.        Video Keyboard can also be dragged in front of modal dialogs. If you
  84.        are in the habit of using QuickDraw calls to draw items in Dialog
  85.        Manager modal dialogs instead of creating custom dialog userItems,
  86.        Video Keyboard users can drag the keyboard window in front of your
  87.        dialog and erase the items (since the only items redrawn are those
  88.        redrawn by the Dialog Manager's update routine).    You can easily
  89.        test this in all of your dialogs by obscuring each dialog with the
  90.        Video Keyboard window a piece at a time, then moving Video Keyboard
  91.        away, to be sure that all areas are completely redrawn.
  92.  
  93.        Let's say, for example, that you have a custom text item that changes
  94.        between invocations of the same modal dialog.  You might choose to
  95.        draw the text yourself with LETextBox2 after creating the dialog with
  96.        GetNewModalDialog but before letting the Dialog Manager handle events
  97.        with ModalDialog:
  98.  
  99.      phx                      ; port: hi word from GetNewModalDialog
  100.      pha                      ; port: lo word from GetNewModalDialog
  101.      _SetPort
  102.  
  103.      lda OurText+2            ; pointer to text to draw in modal dialog
  104.      pha
  105.      lda OurText
  106.      pha
  107.      lda OurTextLength        ; Text length
  108.      pha
  109.      pea OurTextRect>>16      ; Text rectangle
  110.      pea OurTextRect
  111.      pea 0002                 ; Text justification (2 = fill)
  112.      _LETextBox2
  113.  
  114.      To be Universal Access-friendly, you would, instead, implement a
  115.      userItem routine like the following:
  116.  
  117.      ; . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  118.      DrawDialogText
  119.      ;
  120.      ; DrawDialogText draws text pointed to by OurText into the Dialog.
  121.      ; This userItem routine is called only by the Dialog Manager,
  122.      ;   when it's implementing/updating the dialog.
  123.      ; . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  124.  
  125.           lda >OurText+2           ; pointer to text to draw in modal dialog
  126.           pha
  127.           lda >OurText             ; (long addressing: data bank unknown)
  128.           pha
  129.           lda >OurTextLength       ; Text length
  130.           pha
  131.           pea OurTextRect>>16      ; Text rectangle
  132.           pea OurTextRect
  133.           pea 0002                 ; Text justification (2 = fill)
  134.           _LETextBox2
  135.  
  136.           lda 1,s                  ; get return address
  137.           sta 7,s                  ; move to proper location
  138.           lda 2,s                  ;  above input parameters
  139.           sta 8,s
  140.  
  141.           pla                      ; move stack pointer up
  142.           pla                      ;  to new return address location
  143.           pla
  144.           rtl
  145.  
  146.        It will be called as a result of adding a template item like the
  147.        following to the dialog template (note use of Item Value for the text
  148.        length, since template Value fields are not used by userItems):
  149.  
  150.      TextTemplate  dc.w 3                          ; ID
  151.      OurTextRect   dc.w TTop,TLeft,TBottom,TRight
  152.                    dc.w UserItem+ItemDisable       ; Type
  153.                    dc.l DrawDialogText             ; Pointer to our userItem
  154.                                                    ; routine
  155.      OurTextLength ds.w 1                          ; Text length (cheap place
  156. ;                                                  ; to put it)
  157.                    dc.w 0000                       ; Item flag
  158.                    dc.l 00000000                  ; Item color
  159.  
  160.        Note that this is a simple example of a custom item routine; if you
  161.        really had custom text that changed from invocation to invocation, you
  162.        could use the existing Dialog Manager ParamText and longStatText2 item
  163.        mechanisms.
  164.  
  165.    o   Use the Event Manager routines for event information.  Do not access
  166.        any hardware directly or use the lower-level Miscellaneous Tools
  167.        routines for user event information--you steal that information from
  168.        Universal Access.  For example, use the Event Manager routine GetMouse
  169.        to find the mouse location. Do not use ReadMouse or you steal mouse
  170.        movement information from Universal Access.
  171.  
  172.    o   Call GetNextEvent or TaskMaster often.  Long delays between calls do
  173.        not let NDAs like Video Keyboard get events.  If you cannot make these
  174.        calls, at least call SystemTask.
  175.  
  176.    o   Do not assume that the hardware location of the screen is $E12000.
  177.        Universal Access components that manipulate the entire screen (like
  178.        CloseView) move the virtual screen so the hardware can be used for the
  179.        magnified screen image.
  180.  
  181.        To find the screen location, look at the ptrToPixImage field in a
  182.        grafPort after calling OpenPort (or in your window's window record
  183.        after NewWindow).  The image pointer gives the correct location of the
  184.        screen.
  185.  
  186.        Assuming the current port is on screen, the following code finds the
  187.        ptrToPixImage value:
  188.  
  189.           pha
  190.           pha                     ;made space for port pointer
  191.           _GetPort
  192.           phd                     ;save direct page location
  193.           tsc
  194.           tcd                     ;port pointer is now at 3..6 on direct page
  195.           ldy #4                  ;offset to high word of ptrToPixImage
  196.           lda [3],y               ;got high word
  197.           tax                     ;  in X
  198.           ldy #2                  ;offset to low word of ptrToPixImage
  199.           lda [3],y               ;got low word
  200.           tay                     ;  in Y
  201.           pld                     ;restored direct page location
  202.           pla
  203.           pla                     ;removed port pointer
  204.  
  205.      The X and Y registers now contain the base address of the screen.
  206.  
  207.  
  208.    o   Do not assume things about being the frontmost window.  Even if
  209.        FrontWindow says you have the frontmost window, your visRgn may have
  210.        pieces missing.  For example, the title bar of your window may be
  211.        partially under the menu bar.  Or there may be a floating "windoid"
  212.        (like Video Keyboard's window) over part of your window.
  213.  
  214.        For these reasons you should not draw directly to the screen without
  215.        first examining your window's visRgn.  Do not just check for
  216.        rectangularity--your visRgn could be rectangular and parts of your
  217.        window still be obscured.  If you use QuickDraw for all your drawing,
  218.        QuickDraw automatically clips drawing activity to be entirely within
  219.        the visRgn, so this is not a problem.
  220.  
  221.    o   Don't access QuickDraw data directly; use QuickDraw routines instead.
  222.        For example, to access SCB data, use the QuickDraw routines GetSCB and
  223.        SetSCB instead of reading the hardware at $E19D00.  CloseView may have
  224.        those SCBs changed to reflect a magnified portion of the screen.  Also
  225.        use GetColorEntry, SetColorEntry, GetColorTable, and SetColorTable.
  226.        Don't access the hardware directly.
  227.  
  228.    o   Try to allocate memory after starting the tools.  If you want to
  229.        allocate memory before starting tools, do not use special memory.
  230.        (Set the attrNoSpec bit in the attributes.)
  231.  
  232.  
  233. Further Reference
  234. _____________________________________________________________________________
  235.  
  236.    o   Apple IIgs Toolbox Reference
  237.    o   Apple IIgs Firmware Reference
  238.    o   Apple II Video Overlay Card Development Kit (APDA)
  239.